$(function () {
    Table.builder()
        .listUrl(STAION_CONTROL_RECORD_LIST_ALL)
        .init();
});

columns = [
    {
        field: 'createTime',
        title: '控制时间',
        align: 'center',
        valign: 'middle',
        formatter: function (value, row, index) {
            return DateUtil.changeDateToString(value, DateFormatEnum.YYYY_MM_DD_HH_MM);
        }
    }, {
        field: 'stationName',
        title: '设备名称',
        align: 'center',
        valign: 'middle'
    }, {
        field: 'createUser',
        title: '操作用户',
        align: 'center',
        valign: 'middle'
    }, {
        field: 'type',
        title: '控制类型',
        align: 'center',
        valign: 'middle',
        formatter: function (value, row, index) {
            if (value === 0) {
                return "<span style='color:#1c84c6;font-weight: bold;'>页面控制</span>";
            } else if (value === 1) {
                return "<span style='color:#73CDAA;font-weight: bold;'>设备控制</span>";
            }
        }
    }, {
        field: 'operate',
        title: '操作类型',
        align: 'center',
        valign: 'middle',
        formatter: function (value, row, index) {
            if (value === "feed") {
                return "<span>自由投喂</span>";
            } else if (value === "calibration") {
                return "<span>校准标定</span>";
            } else if (value === "task") {
                return "<span>设置任务</span>";
            } else if (value === "mode") {
                return "<span>切换模式</span>";
            } else if (value === "firmware") {
                return "<span>固件更新</span>";
            } else if (value === "reset") {
                return "<span>设备重启</span>";
            } else if (value === "status") {
                return "<span>读取状态</span>";
            } else if (value === "recon") {
                return "<span>对账召回</span>";
            } else if (value === "ration") {
                return "<span>定量补料</span>";
            } else if (value === "timing") {
                return "<span>持续补料</span>";
            } else if (value === "stop") {
                return "<span>停止上行</span>";
            } else if (value === "upgradeStart") {
                return "<span>固件更新</span>";
            }
        }
    }, {
        field: 'status',
        title: '状态',
        align: 'center',
        valign: 'middle',
        formatter: function (value, row, index) {
            if (value === 0) {
                return "<span style='color:red'>云端缓存</span>";
            } else if (value === 1) {
                return "<span style='color:green'>已下发</span>";
            } else if (value === 2) {
                return "<span style='color:green'>已应答</span>";
            } else if (value === 99) {
                return "<span style='color:red'>超时</span>";
            } else {
                return "未知";
            }
        }
    }, {
        field: 'content',
        title: '控制内容',
        align: 'center',
        valign: 'middle'
    }
]
